﻿using Basic.UserRemoteModel.User;
using Basic.UserRemoteModel.User.Model;
using Basic.UserService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.UserService.RpcEvent
{
    internal class UserEvent : IRpcApiService
    {
        private readonly IUserLogic _Service;

        public UserEvent (IUserLogic service)
        {
            this._Service = service;
        }
        public void DisableUser (DisableUser obj)
        {
            this._Service.Disable(obj.Id);
        }
        public void EnableUser (EnableUser obj)
        {
            this._Service.Enable(obj.Id);
        }
        public PagingResult<UserData> QueryUser (QueryUser obj)
        {
            return this._Service.Query(obj.Query, obj.ToBasicPage());
        }
        public void ResetUserPwd (ResetUserPwd obj)
        {
            this._Service.ResetPwd(obj.Id, obj.Pwd);
        }
        public void SetUserPwd (SetUserPwd obj)
        {
            this._Service.SetPwd(obj.Id, obj.OldPwd, obj.Pwd);
        }
        public bool SetUserDatum (SetUserDatum obj)
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
    }
}
